home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 14 / Mac Magazin and MacEasy Magazine CD - Issue 14.iso / Utilities / Grabbug1.0b2 Folder / Source / GrabbugDcmd.p < prev    next >
Encoding:
Text File  |  1995-08-24  |  3.0 KB  |  112 lines  |  [TEXT/MPS ]

  1. unit GrabbugDcmd;
  2.  
  3. (* ©1995 Quinn "The Eskimo!" *)
  4. (* This file is distributed as Freeware. *)
  5.  
  6. (*
  7.  
  8. Compiling Grabbug dcmd
  9. ----------------------
  10.  
  11. 0. I compiled this with MPW Shell 3.3.1, UPI 2.0 and MPW Pascal 3.2.1.
  12.    Your mileage might vary.
  13.  
  14. 1. Use the MPW directory command to set the current directory to the folder
  15.    containing this source file.
  16.      
  17. 2. Modify the first line of the script in 3 so that the Dcmd variable points
  18.    to your copy of MacsBug developer kit.
  19.  
  20. 3. Execute the following script:
  21.  
  22. Set Dcmd "SuperGrover:Languages:MacsBug Developer Kit:dcmds:"
  23. Export Dcmd
  24. Pascal GrabbugCommon.p
  25. Pascal -i "{Dcmd}dcmd Includes:" GrabbugDcmd.p
  26. Link -o "Grabbug" -c 'RSED' -t 'rsrc' -sg MyMain=PASLIB,Main ∂
  27.         "{Dcmd}dcmd Libraries:"dcmdGlue.a.o ∂
  28.         GrabbugDcmd.p.o ∂
  29.         GrabbugCommon.p.o ∂
  30.         "{Libraries}"Interface.o ∂
  31.         "{Libraries}"Runtime.o ∂
  32.         "{PLibraries}"PasLib.o        
  33. BuildDcmd "Grabbug" 666 -format3
  34. Echo 'include "Grabbug";' | Rez -a -o "{SystemFolder}Debugger Prefs"
  35.  
  36. 4. The TestDcmd program will not work with this dcmd, I think because
  37.    it doesn't support format 3 dcmds.
  38.  
  39. *)
  40.  
  41. interface
  42.  
  43.     uses
  44.         Types,
  45.         TextUtils,
  46.         Files,
  47.         (* for some reason all UPI uses must go before Dcmd.p  *sigh* *)
  48.         Dcmd;
  49.  
  50.     procedure CommandEntry (paramPtr: dcmdBlockPtr);
  51.  
  52. implementation
  53.  
  54.     uses
  55.         GrabbugCommon;
  56.  
  57.     var
  58.         refcon : longint;
  59.  
  60.     procedure CommandEntry (paramPtr: dcmdBlockPtr);
  61.         var
  62.             err : OSErr;
  63.             errstr : Str255;
  64.             errmsg : Str255;
  65.     begin
  66.         err := noErr;
  67.         case paramPtr^.request of
  68.             dcmdSecondaryInit :
  69.                 err := DoInit(refcon);
  70.             dcmdShutdown :
  71.                 DoTerm(refcon);
  72.             dcmdDoIt :
  73.                 begin
  74.                     dcmdSwapScreens;
  75.                     err := DoGrab(refcon);
  76.                     if err = noErr then begin
  77.                         dcmdDrawLine ('Snap!');
  78.                     end; (* if *)
  79.                     dcmdSwapScreens;
  80.                 end;
  81.             dcmdHelp :
  82.                 begin
  83.                     dcmdDrawLine ('Grabbug');
  84.                     dcmdDrawLine ('  Grabs screen to internal buffer. Use Grabbug Dump application to get it out again.');
  85.                 end;
  86.             dcmdGetInfo :
  87.                 begin
  88.                     GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.usageStr := '';
  89.                     GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.creditsStr := '©1995 Quinn "The Eskimo!"';
  90.                     GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.majorRev := $01;
  91.                     GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.minorAndBugRev := $00;
  92.                     GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.stage := betaStage;
  93.                     GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.nonRelRev := $02;
  94.                 end;
  95.         otherwise
  96.             (* do nothing *)
  97.         end; (* case *)
  98.         if err <> noErr then begin
  99.             NumToString(err, errstr);
  100.             case err of
  101.                 screenSizeChangedErr :
  102.                     errmsg := 'The screen changed size between system startup time and the grab';
  103.                 noMainGDeviceErr :
  104.                     errmsg := 'Can’t find the main device (in which case how are you reading this message?)';
  105.             otherwise
  106.                 errmsg := 'Unknown error';
  107.             end; (* case *)
  108.             dcmdDrawLine(concat('Grabbug error: ', errmsg, '. (', errstr, ')'));
  109.         end; (* if *)
  110.     end; (* CommandEntry  *)
  111.  
  112. end. (* GrabbugDcmd *)